package com.example.pmxt.modules.carousel;

import com.example.pmxt.common.BaseService;
import com.example.pmxt.domain.Carousel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class CarouselService extends BaseService<CarouselMapper, Carousel> {

    private CarouselMapper carouselMapper;

    @Autowired
    public CarouselService( CarouselMapper carouselMapper){
        this.carouselMapper = carouselMapper;
    }

    //全文检索
    public List<Carousel> selectByInput(String input){
        return carouselMapper.selectByInput(input);
    }

    //查询全部
//    public List<Carousel> selectAll(){
//        return carouselMapper.selectAll();
//    }

    //新增轮播图
    @Transactional
    public int insert(Carousel carousel){
        return carouselMapper.insert(carousel);
    }

    //修改轮播图
    @Transactional
    public int update(Carousel carousel){
        return carouselMapper.updateById(carousel);
    }

    //逻辑删除轮播图
    @Transactional
    public int delete(Integer id) {
        return carouselMapper.delete(id);
    }
}
